import {channels} from '@/api/index'

const state={
  typeList:[],
  currentId:"",
}
const mutations={
  setTypeList(state,value){
    state.typeList=value
  },
  setCurrentId(state,value){
    state.currentId=value
  }
}
const actions={
  // 完成定义
  async getTypeList(store){
    const res=await channels()
    store.commit('setTypeList',res.data.data.channels)
    store.commit('setCurrentId',res.data.data.channels[0].id)

    // 调用完成后详情
    store.dispatch('list/getInfoList',res.data.data.channels[0].id,{root:true})

    console.log(res);
  }
}
const getters={}


export default{
  namespaced:true,
  state,
  mutations,
  actions,
  getters
}